package com.hongyuan.coach.ui.home.beans;

import com.chad.library.adapter.base.entity.AbstractExpandableItem;
import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class StudentsBeans implements Serializable {

    /**
     * list : [{"m_id":15535,"m_mobile":"15825507418","m_name":"中文","mi_realname":"大王","mi_sex":1,"mi_head":"http://hongyuangood.oss-cn-hangzhou.aliyuncs.com/uplaod/image/20200515/b50700cf80e7a5d543ea3cb98a29aadfb7f29709_1334x1334.jpg","course_list":[{"my_course_id":61,"cp_name":"嗯啦","have_num":10,"ocp_num":10,"add_date":"2020-07-01 05:38:38","add_time":1593596315,"ocp_money":"0.01"}]}]
     * page : 10
     * curpage : 1
     * page_total : 0
     */

    private int page;
    private int curpage;
    private int page_total;
    private List<ListBean> list;

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getCurpage() {
        return curpage;
    }

    public void setCurpage(int curpage) {
        this.curpage = curpage;
    }

    public int getPage_total() {
        return page_total;
    }

    public void setPage_total(int page_total) {
        this.page_total = page_total;
    }

    public List<ListBean> getList() {
        return list;
    }

    public void setList(List<ListBean> list) {
        this.list = list;
    }

    /**************************************获取组装数据*****************************************/

    //需要使用的数据
    private List<MultiItemEntity> mList;
    /*
     * 处理下数据
     * */
    public List<MultiItemEntity> getmList(){
        if(list != null){
            mList = new ArrayList<>();

            for(ListBean listBean : list){
                label:for(ListBean.CourseListBean courseListBean : listBean.getCourse_list()){

                    if(listBean.getSubItems() != null){
                        //去重复添加
                        for(ListBean.CourseListBean haveBean : listBean.getSubItems()){
                            if(courseListBean.getMy_course_id() == haveBean.getMy_course_id()){
                                //跳出外层循环继续下一次循环
                                continue label;
                            }
                        }
                    }
                    listBean.addSubItem(courseListBean);
                }
                mList.add(listBean);
            }
        }

        return mList;
    }

    public static class ListBean extends AbstractExpandableItem<ListBean.CourseListBean> implements MultiItemEntity {
        /**
         * m_id : 15535
         * m_mobile : 15825507418
         * m_name : 中文
         * mi_realname : 大王
         * mi_sex : 1
         * mi_head : http://hongyuangood.oss-cn-hangzhou.aliyuncs.com/uplaod/image/20200515/b50700cf80e7a5d543ea3cb98a29aadfb7f29709_1334x1334.jpg
         * course_list : [{"my_course_id":61,"cp_name":"嗯啦","have_num":10,"ocp_num":10,"add_date":"2020-07-01 05:38:38","add_time":1593596315,"ocp_money":"0.01"}]
         */

        private int m_id;
        private String m_mobile;
        private String m_name;
        private String mi_realname;
        private int mi_sex;
        private String mi_head;
        private List<CourseListBean> course_list;

        public int getM_id() {
            return m_id;
        }

        public void setM_id(int m_id) {
            this.m_id = m_id;
        }

        public String getM_mobile() {
            return m_mobile;
        }

        public void setM_mobile(String m_mobile) {
            this.m_mobile = m_mobile;
        }

        public String getM_name() {
            return m_name;
        }

        public void setM_name(String m_name) {
            this.m_name = m_name;
        }

        public String getMi_realname() {
            return mi_realname;
        }

        public void setMi_realname(String mi_realname) {
            this.mi_realname = mi_realname;
        }

        public int getMi_sex() {
            return mi_sex;
        }

        public void setMi_sex(int mi_sex) {
            this.mi_sex = mi_sex;
        }

        public String getMi_head() {
            return mi_head;
        }

        public void setMi_head(String mi_head) {
            this.mi_head = mi_head;
        }

        public List<CourseListBean> getCourse_list() {
            return course_list;
        }

        public void setCourse_list(List<CourseListBean> course_list) {
            this.course_list = course_list;
        }

        @Override
        public int getLevel() {
            return 0;
        }

        @Override
        public int getItemType() {
            return 0;
        }

        public static class CourseListBean implements MultiItemEntity{
            /**
             * my_course_id : 61
             * cp_name : 嗯啦
             * have_num : 10
             * ocp_num : 10
             * add_date : 2020-07-01 05:38:38
             * add_time : 1593596315
             * ocp_money : 0.01
             */

            private int my_course_id;
            private String cp_name;
            private int have_num;
            private int ocp_num;
            private String add_date;
            private int add_time;
            private String ocp_money;
            private boolean select;

            public boolean isSelect() {
                return select;
            }

            public void setSelect(boolean select) {
                this.select = select;
            }

            public int getMy_course_id() {
                return my_course_id;
            }

            public void setMy_course_id(int my_course_id) {
                this.my_course_id = my_course_id;
            }

            public String getCp_name() {
                return cp_name;
            }

            public void setCp_name(String cp_name) {
                this.cp_name = cp_name;
            }

            public int getHave_num() {
                return have_num;
            }

            public void setHave_num(int have_num) {
                this.have_num = have_num;
            }

            public int getOcp_num() {
                return ocp_num;
            }

            public void setOcp_num(int ocp_num) {
                this.ocp_num = ocp_num;
            }

            public String getAdd_date() {
                return add_date;
            }

            public void setAdd_date(String add_date) {
                this.add_date = add_date;
            }

            public int getAdd_time() {
                return add_time;
            }

            public void setAdd_time(int add_time) {
                this.add_time = add_time;
            }

            public String getOcp_money() {
                return ocp_money;
            }

            public void setOcp_money(String ocp_money) {
                this.ocp_money = ocp_money;
            }

            @Override
            public int getItemType() {
                return 1;
            }
        }
    }
}
